Skip to content

Conversation

@VisualFox
Copy link
Contributor

@VisualFox VisualFox commented Aug 30, 2025

attempt to fix #208

//doesn't compile missing DIP_EXPORT for Image::Pixel != Image::Pixel in include/diplib/library/image_views.h at line 787
if ( kernelImageA.At(0) != kernelImageB.At(0) ) {
    std::cout << "also expected" << std::endl;
}


/// \brief Comparison operator, equivalent to `!(lhs==rhs)`.
/// \relates dip::Image::Pixel
DIP_EXPORT bool operator!=( Image::Pixel const& lhs, Image::Pixel const& rhs );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A trivial function like this can be defined inline:

inline bool operator!=( Image::Pixel const& lhs, Image::Pixel const& rhs ) { return !( lhs == rhs ); }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I just implement it in image_view.h in this case? Seem a bit silly to put that one in pixel.cpp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was the intention. That allows the optimizing compiler to skip one function call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@crisluengo crisluengo merged commit d5e2be4 into DIPlib:master Aug 30, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing DIP_EXPORT for Image::Pixel != Image::Pixel (image_views.h)

2 participants